<!--
 * @Author: zhangxianyi l
 * @Date: 2025-07-22 10:19:30
 * @LastEditors: zhangxianyi l
 * @LastEditTime: 2025-07-22 11:21:39
 * @FilePath: \RuoYi-App11\App.vue
 * @Description: 
 * 
 * Copyright (c) 2025 by ${git_name_email}, All Rights Reserved. 
-->
<script setup>
import config from "./config";
import { getToken } from "@/utils/auth";
import { useConfigStore } from "@/store";
import { getCurrentInstance } from "vue";
import { onLaunch } from "@dcloudio/uni-app";

const { proxy } = getCurrentInstance();

onLaunch(() => {
  initApp();
});

// 初始化应用
function initApp() {
  // 初始化应用配置
  initConfig();
  // 检查用户登录状态
  //#ifdef H5
  checkLogin();
  //#endif
}

function initConfig() {
  useConfigStore().setConfig(config);
}

function checkLogin() {
  if (!getToken()) {
    proxy.$tab.reLaunch("/pages/login");
  }
}
</script>

<style lang="scss">
@import "@/static/scss/index.scss";
@import "@/uni_modules/sard-uniapp/index.scss";
//  page,
//   .sar-portal {
//     font-family:
//       system-ui,
//       -apple-system,
//       'Segoe UI',
//       Roboto,
//       'Helvetica Neue',
//       'Noto Sans',
//       'Liberation Sans',
//       Arial,
//       sans-serif,
//       'Apple Color Emoji',
//       'Segoe UI Emoji',
//       'Segoe UI Symbol',
//       'Noto Color Emoji',
//       monospace;
//     font-size: var(--sar-text-base);
//     color: var(--sar-body-color);
//     -webkit-tap-highlight-color: transparent;
//   }
</style>
